//使用interface 定义对象的结构
interface PersonA {
  name: string;
  age: number;
  speak(): void;
}

//使用type 定义对象的结构
type PersonB = {
  name: string;
  age: number;
  speak(): void;
};

//interface与type都可以定义对象结构

let pA: PersonA = {
  name: "张三",
  age: 18,
  speak() {
    console.log("说话");
  },
};

let pB: PersonB = {
  name: "张三",
  age: 18,
  speak() {
    console.log("说话");
  },
};
